<?php  if( ! defined('BASEPATH')) exit('No direct script access allowed');

if ( ! function_exists('_session'))
{
	function _session($ndx)
	{
		$CI =& get_instance();
		$CI->load->library('Session');
		
		return $CI->session->userdata($ndx);
	}
}

if ( ! function_exists('_error'))
{
	function _error($msg = NULL, $landing = TRUE)
	{
		if (empty($msg)) $msg = lang('cms_error');
		
		_message($msg, 'error', $landing);
		
		return TRUE;
	}
}

if ( ! function_exists('_success'))
{
	function _success($msg, $landing = TRUE)
	{
		if (empty($msg)) $msg = lang('cms_success');
		
		_message($msg, 'success', $landing);
		
		return TRUE;
	}
}

if ( ! function_exists('_message'))
{
	function _message($msg = NULL, $type = 'success', $landing = TRUE)
	{
		$CI =& get_instance();
		$CI->load->library('Session');
		
		$CI->session->set_flashdata($type, $msg);
		
		if ($landing === TRUE && isset($CI->landing)) echo $CI->landing;
			
		return TRUE;
	}
}

/* End of file session_helper.php */
/* Location: ./application/helpers/session_helper.php */
